using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class personal_accident_Personal_Accident_Master : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string _strMaintenance = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsMaintenance");
        if (_strMaintenance == "1")
        {
            Response.Redirect("~/maintenance.aspx");
        }
        string _strCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsCXLive");
        string _strPALive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("IsPALive");
        if (_strCXLive == "0" && _strPALive == "0")
        {
            if (Session[CE.Global.General.Guest] == null)
            {
                Response.Redirect("~/default.aspx");
            }
            else if (Session[CE.Global.General.Guest].ToString() == "Provider")
            {
                if (Session[CE.Global.General.UserId] == null)
                {
                    Response.Redirect("~/provider/providersecurelogin.aspx");
                }
                //Response.Redirect("~/Provider/ProviderHome.aspx");
            }
        }
        //else
        //{
        //    Response.Redirect("comingsoon.aspx");
        //}
        
        if (Session[CE.Global.General.UserId] != null)
        {
            //string sKey = CE.Configuration.MyConfigurationManager.GetAppSettingValue("UserCacheName");
            //sKey += Convert.ToString(Session[CE.Global.General.UserId].ToString());

            
            //// Accessing the Cache Item extends the Sliding Expiration automatically
            //if (HttpContext.Current.Cache[sKey] != null)
            //{
            //    string sUser = (string)HttpContext.Current.Cache[sKey];
            //}
            //else
            //{
            //    TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
            //    HttpContext.Current.Cache.Insert(sKey, Session[CE.Global.General.UserId].ToString(), null, DateTime.MaxValue, SessTimeOut,
            //       System.Web.Caching.CacheItemPriority.NotRemovable, null);
            //}
            CE.Global.General.CreateUpdateUserLoginCached(Page);

            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "JS_AjaxSessionTimer", "../includes/AjaxSessionTimer.js");
            Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "JS_Net", "../includes/net.js");
        }
    }
}
